class Celsius:
    def __init__(self, temperature = 0):
        self.temperature = temperature
        # self.set_temperature(temperature)

    def to_fahrenheit(self):
        return (self.temperature * 1.8) + 32
        # return (self.get_temperature() * 1.8) + 32


    def get_temperature(self):
        print("获得的值")
        return self._temperature

    def set_temperature(self, value):
        if value < -273:
            raise ValueError("零下273度是不可能的")
        print("设定值")
        self._temperature = value

    # 通过Celsius的实例访问temperature属性 就要去调用get_temperature方法
    # 通过Celsius的实例修改temperature属性 就要去调用set_temperature方法
    temperature = property(get_temperature,set_temperature)

certifi = Celsius(-470)
print(certifi.temperature)
certifi.temperature = -260
print(certifi.temperature)